@import 'mixins';
@import 'vars';

/* stylelint-disable no-descending-specificity */

$list-height: 2.25rem;

@mixin overlay-container {
    overflow: hidden;
    padding: 0;
    position: relative;
}

@mixin overlay {
    @include absolute(0, 0, 0, 0);
    color: $color-white;
    cursor: none;
    display: flex;
    opacity: 0;
    transition: opacity .4s ease;

    &-background {
        @include absolute(0, 0, 0, 0);
        background: $color-black;
        border: 0;
        border-radius: 0;
        opacity: .7;
    }
}

@mixin asset-type {
    color: $color-white;
    cursor: none;
    font-size: $font-smallest;
    font-weight: normal;
    padding: .1rem .25rem;
    text-transform: uppercase;
}

:host {
    width: auto;
}

:host ::ng-deep {
    .form-control {
        &.disabled,
        &:disabled {
            background: transparent;
        }
    }
}

/* stylelint-disable-next-line selector-class-pattern */
:host(.isListView) {
    padding: 0;
}

.card {
    @include overlay-container;
    border-width: 1px;
    border-top-width: 1px;
    margin-bottom: 1rem;
    margin-right: .5rem;
    width: $asset-width;

    &-body {
        @include force-height($asset-header);
        padding: 1rem;
        position: relative;
    }

    &-footer {
        max-height: none;
        min-height: $asset-footer;
        padding: 1rem;
        padding-top: .5rem;
        position: relative;
    }
}

.upload-progress {
    @include absolute(1rem, 3em, 1rem, 3rem);
}

.file {
    &-preview {
        @include absolute(0, 0, 0, 0);

        &:hover {
            .overlay {
                opacity: 1;
            }

            .file-type {
                opacity: 0;
            }
        }
    }

    &-type {
        @include absolute(1rem, auto, auto, 1rem);
        @include asset-type;
        border: 0;
        border-radius: .25rem;
        background: $color-black;
        transition: opacity .4s ease;
    }

    &-image {
        height: $asset-image;

        img {
            background-image: $asset-background;
            object-fit: contain;
            object-position: inherit;
        }
    }

    &-name {
        line-height: 2rem;

        i {
            font-size: $font-smallest;
        }
    }

    &-tags {
        margin-bottom: .25rem;
    }

    &-info {
        font-size: $font-smallest;
    }

    &-icon {
        background: $color-border-light;
        border: 0;
        height: $asset-image;
        padding: 2rem;
        text-align: center;
    }
}

.overlay {
    @include overlay;
    cursor: pointer;
    font-size: $font-smallest;
    font-weight: normal;

    &-menu {
        @include absolute(1rem, 1rem, auto, auto);

        a {
            color: darken($color-white, 10%);
            cursor: pointer;
            font-size: 1.1rem;
            font-weight: normal;
            text-decoration: none;

            &:hover {
                color: $color-white;
            }

            &:focus,
            &:hover {
                text-decoration: none;
            }
        }
    }

    &-type {
        @include absolute(1rem, auto, auto, 1rem);
        @include asset-type;
    }

    &-user {
        @include absolute(auto, auto, 1rem, 1rem);
    }
}

.table-items-row {
    height: $list-height + 2rem;
    padding-left: $list-height + 3rem;
    position: relative;

    .left-border {
        @include absolute(0, auto, auto, 0);
        background: $color-border;
        border: 0;
        height: $list-height + 2rem;
        width: 4px;

        &.selected {
            background: $color-theme-brand;
        }
    }

    .image {
        @include absolute(0, auto, 0, 4px);
        background: $color-border-light;
        border: 0;
        width: $list-height + 2rem;

        &-padded {
            padding: 1rem;
        }

        &-left {
            left: 0;
        }
    }

    .icon {
        max-width: 100%;
    }

    .col {
        height: $list-height;

        &-name {
            width: 50% !important;
        }

        &-info {
            width: 50% !important;
        }

        &-name {
            padding-right: .5rem;
        }

        &-user {
            width: 3rem;
        }

        &-actions {
            width: 6rem;
        }

        &-delete {
            width: 3rem;
        }

        &-info {
            color: $color-text-decent;
            font-size: $font-small;
            font-weight: normal;
            width: 12rem;
        }
    }

    table {
        width: 100%;
    }

    .upload-progress {
        padding: .25rem 0;
    }
}

.drop-overlay {
    @include overlay;
    pointer-events: none;

    &-text {
        font-size: 1.25rem;
        font-weight: normal;
        position: absolute;
    }
}

.drag {
    .drop-overlay {
        opacity: 1;
    }

    .file-type {
        opacity: 0;
    }
}

img {
    max-height: 100%;
}

.selectable {
    cursor: pointer;
}

.tag {
    background: $color-border;
    border: 0;
    border-radius: 2px;
    color: $color-text;
    display: inline-block;
    margin-bottom: .25rem;
    margin-right: 2px;
    padding: 1px .5rem;
    vertical-align: top;
    white-space: nowrap;
}